﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
using Microsoft.Exchange.WebServices.Data;
using MsExchangeBcsConnector.ExchangeBdcModel.Helpers;

namespace MsExchangeBcsConnector.ExchangeBdcModel
{
    [Browsable(true)]
    public class Attachment : SecureEntity
    {
        public string AttachmentID { get; set; }
        public string MessageID { get; set; }
        public string Name { set; get; }
        public int Size { get; set; }
        public string ContentType { set; get; }
        public string ContentId { set; get; }
        public System.DateTime LastModified { get; set; }
        public string Url { get; set; }

        //    private Stream attachmentStream = null;
        public MemoryStream AttachmentStream { get; set; }
   

        public Attachment()
        {
            this.LastModified = DateTime.Now;
        }

        internal static string FormatDisplayUrl(string BcsProfile_HostURL, string LobSystemInstanceName, string MessageId, string AttachmentId)
        {
            return String.Format("{0}/{1}.eml", BcsProfile_HostURL, Base32Url.ToBase32String(MessageId));
        }
    }
}
